C     Program EX_0301.FOR
C     Listing 4F - see documntation in TUTOR.SSS
 
$include:'SSSF1.H'
 
      real*8 function rnx(m, s)
$include:'SSSF2.H'
      real*8 m, s, x
  99  x = RN(m, s)
      if (x.lt.0.0) goto 99
      rnx = x
      return
      end
 
      subroutine prime
$include:'SSSF2.H'
      real*8 x, pt, pv, rnx, mean, sd, free, busy
      common x, pt, pv, mean, sd, free, busy
 
      mean = 7.0
      sd   = 4.0
      free = 0.0
      busy = 1.0
      call INIQUE(0, 0, 1)
      call inista(1,'Busy fraction        ',1, 0, 0, 0)
      call TALLY(1, free)
      call SETT(rnx(mean, sd))
      call TALLY(1, busy)
      return
      end
 
      Program EX_0301
$include:'SSSF2.H'
      real*8 x, pt, pv, rnx, mean, sd, free, busy
      common x, pt, pv, mean, sd, free, busy
      real*8 erm, min, mode, max
      data erm /2.0/, min /1.0/, mode /3.0/, max /4.0/
 
      call prime
 
  99    if (RA().lt.0.25) then
          call SETT(T() + ER(2, erm))
        else
          call SETT(T() + TR(min, mode, max))
        endif
        call TALLY(1, free)
        call SETT(T() + rnx(mean, sd))
        call TALLY(1, busy)
      if (T().lt.120.0) goto 99
 
      call SUMRY(' ')
      end
 